import axios from 'axios'

const service = axios.create({
    baseURL: process.env.BASE_URL,
    timeout: 30000 // 请求超时时间
})

// request拦截器
service.interceptors.request.use(
    config => {
        return config
    },
    error => {
        return Promise.reject(error)
    }
)

// respone拦截器
service.interceptors.response.use(
    response => {
        return Promise.resolve(response.data)
    },
    error => {
        return Promise.reject(error)
    }
)

export default service
